package com.example.demo.dao;

import com.example.demo.pojo.Warehouse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface WarehouseDao {
    //删除仓库
    int deleteByPrimaryKey(Integer repertoryid);
    //添加仓库
    int insert(Warehouse record);
    int insertSelective(Warehouse record);
    //通过主键查询
    Warehouse selectByPrimaryKey(Integer repertoryid);
    //通过仓库名字查找
     @Select("select * from warehouse where name=#{name}")
    Warehouse selectByName(@Param("name") String name);
     //通过用户id查找仓库id
    @Select("select * from warehouse where ucid=#{backgroundUserId}")
    Warehouse selectByUserId(@Param("backgroundUserId") Integer backgroundUserId);
    //修改
    int updateByPrimaryKeySelective(Warehouse record);
   //通过主键修改
    int updateByPrimaryKey(Warehouse record);
    //查找全部
    @Select("select * from warehouse")
    List<Warehouse> selectAll();
    int updWareUserName(@Param("userName") String userName,@Param("userId") int userId);
}